#include "ecv_vi.h"

G_DEFINE_TYPE (EcvVi, ecv_vi, G_TYPE_OBJECT);

#define ECV_VI_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ECV_TYPE_VI, EcvViPrivate))

struct _EcvViPrivate
{
  int a;
};
/*
static void
ecv_vi_set_property (GObject      *object,
                        guint         property_id,
                        const GValue *value,
                        GParamSpec   *pspec)
{
  EcvVi *self = ECV_VI (object);

  switch (property_id)
    {
    case PROP_ECV_WIDTH:
      self->priv->width = g_value_get_uint (value);
      break;

    case PROP_ECV_HEIGHT:
      self->priv->height = g_value_get_uint (value);
      break;

    case PROP_ECV_BPP:
      self->priv->bpp = g_value_get_uint (value);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
}
*/
/*static void
ecv_vi_get_property (GObject    *object,
                        guint       property_id,
                        GValue     *value,
                        GParamSpec *pspec)
{
  EcvVi *self = ECV_VI (object);

  switch (property_id)
    {
    case PROP_ECV_WIDTH:
      g_value_set_uint (value, self->priv->width);
      break;

    case PROP_ECV_HEIGHT:
      g_value_set_uint (value, self->priv->height);
      break;

    case PROP_ECV_BPP:
      g_value_set_uint (value, self->priv->bpp);
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
    }
    }*/

static void
ecv_vi_dispose (GObject *gobject)
{
  EcvVi *self = ECV_VI (gobject);

  /* 
   * In dispose, you are supposed to free all types referenced from this
   * object which might themselves hold a reference to self. Generally,
   * the most simple solution is to unref all members on which you own a 
   * reference.
   */

  /* dispose might be called multiple times, so we must guard against
   * calling g_object_unref() on an invalid GObject.
   */

  /*  if (self->priv->an_object)
    {
      g_object_unref (self->priv->an_object);
      }*/

  /* Chain up to the parent class */
  G_OBJECT_CLASS (ecv_vi_parent_class)->dispose (gobject);
}

static void
ecv_vi_finalize (GObject *gobject)
{
  EcvVi *self = ECV_VI (gobject);

  //  g_free (self->a_string);

  /* Chain up to the parent class */
  G_OBJECT_CLASS (ecv_vi_parent_class)->finalize (gobject);
}

static GObject *
ecv_vi_constructor (GType                  gtype,
                       guint                  n_properties,
                       GObjectConstructParam *properties)
{
  GObject *obj;

  {
    /* Always chain up to the parent constructor */
    EcvViClass *klass;
    GObjectClass *parent_class;  
    parent_class = G_OBJECT_CLASS (ecv_vi_parent_class);
    obj = parent_class->constructor (gtype, n_properties, properties);
  }
  
  /* update the object state depending on constructor properties */

  return obj;
}

static void
ecv_vi_class_init (EcvViClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);

  GParamSpec *pspec;

  gobject_class->dispose = ecv_vi_dispose;
  gobject_class->finalize = ecv_vi_finalize;
  //  gobject_class->set_property = ecv_vi_set_property;
  //  gobject_class->get_property = ecv_vi_get_property;

  
  g_type_class_add_private (klass, sizeof (EcvViPrivate));
  gobject_class->constructor = ecv_vi_constructor;
}

static void
ecv_vi_init (EcvVi *self)
{
  self->priv = ECV_VI_GET_PRIVATE (self);
  
  //  self->priv->an_object = g_object_new (ECV_TYPE_BA, NULL);
}

//------------------------------------------------------
/*                     methods                        */

void
ecv_vi_create (EcvVi *self)
{
  g_return_if_fail (ECV_IS_VI (self));
  ECV_VI_GET_CLASS (self)->create (self);
}
//------------------------------------------------------

//------------------------------------------------------
void 
ecv_vi_run (EcvVi *self)
{
  g_return_if_fail (ECV_IS_VI (self));
  ECV_VI_GET_CLASS (self)->run (self);
}

//------------------------------------------------------
void 
ecv_vi_step_begin (EcvVi *self)
{
  g_return_if_fail (ECV_IS_VI (self));
  ECV_VI_GET_CLASS (self)->step_begin (self);
}

//------------------------------------------------------

void 
ecv_vi_step_end (EcvVi *self)
{
  g_return_if_fail (ECV_IS_VI (self));
  ECV_VI_GET_CLASS (self)->step_end (self);
}

//------------------------------------------------------

char * 
ecv_vi_get_data (EcvVi *self)
{
  g_return_if_fail (ECV_IS_VI (self));
  return (ECV_VI_GET_CLASS (self)->get_data (self));
}

//------------------------------------------------------

int 
ecv_vi_get_data_size (EcvVi *self)
{
  g_return_if_fail (ECV_IS_VI (self));
  return ( ECV_VI_GET_CLASS (self)->get_data_size (self));
}

//------------------------------------------------------

int
ecv_vi_failed(EcvVi * self)
{
  g_return_if_fail (ECV_IS_VI (self));
  return ( ECV_VI_GET_CLASS (self)->failed (self));
}

//------------------------------------------------------

EcvVi * 
ecv_vi_new ()
{
  return g_object_new (ECV_TYPE_VI,
		       NULL);
}
